<template>

  <el-row :gutter="10" class="mb8">
    <el-col :span="1.5" v-for="(item,index) in definition">
      <el-button
        :id="index"
        v-if="booleanFun(item.if)"
        v-show="booleanFun(item.show)"
        :disabled="!booleanFun(item.disabled)"
        type="primary"
        plain
        size="mini"
        :icon="item.icon"
        @click="item.click()"
        v-hasPermi="item.hasPer"
      >
        {{ item.name }}
      </el-button>
    </el-col>
    <right-toolbar :showSearch.sync="showSearchComputed" @queryTable="queryTable"/>
  </el-row>

</template>

<script>
import {booleanFun} from '@/components/FlyElement/common'

export default {
  name: "aToolbar",
  props: {
    showSearch: {
      type: Boolean,
      required: true
    },
    definition: {
      type: Array,
      required: true
    }
  },
  methods: {
    booleanFun,
    queryTable() {
      this.$emit('queryTable')
    }
  },
  computed: {
    showSearchComputed: {
      get() {
        return this.showSearch
      },
      set(value) {
        this.$emit('update:showSearch', value)
      }
    }
  }

}
</script>

<style scoped>

</style>
